package com.yztc.orangeentertainment.ui.main.subscribefragment.starlist;

import android.content.Context;
import android.util.Log;

import com.yztc.orangeentertainment.adapter.StarListAdapter;
import com.yztc.orangeentertainment.bean.starlistbean.ListBean;
import com.yztc.orangeentertainment.config.SubscribeUrlConfig;
import com.yztc.orangeentertainment.ui.main.subscribefragment.staritem.starfeedfragment.FeedContract;

import java.util.List;
import java.util.Map;

/**
 * Created by My on 2016/10/7.
 */
public class StarListPresenter implements StarListContract.Presenter {
    private StarListContract.View view;
    private StarListModle modle;

    public StarListPresenter(StarListContract.View view) {
        this.view = view;
        modle=new StarListModle();
    }

    @Override
    public void getStarFromNet(boolean flag,Map<String, String> params, final Context context) {
        if (!flag) {
            modle.getStarListAll(SubscribeUrlConfig.PATH.URL_STARLIST_TYPE, params, new OnLoadStarListListener() {
                @Override
                public void onSuccess(List<ListBean> list) {
                    view.onLoadStarListSuccess(list);
                }

                @Override
                public void onFailure(Exception e) {

                }
            }, context);
        }else {
            modle=new StarListModle();
            modle.getSearchStar(SubscribeUrlConfig.PATH.URL_SEARCH_TYPE, params,context, new OnLoadStarListListener() {
                @Override
                public void onSuccess(List<ListBean> list) {
                    view.onLoadSearchStarSuccess(list);
                }

                @Override
                public void onFailure(Exception e) {

                }
            });
        }
    }

    @Override
    public void getStarFromDb() {

    }
}
